﻿#ifndef _JSON_MESSAGE_H_
#define _JSON_MESSAGE_H_

#include <string>
#include "../../3rd/libjson/json.h"
#include "user_define.h"


class CJsonMessageBase
{
public:
	~CJsonMessageBase(){}
	CJsonMessageBase(){}
public:
	bool ParseAcceptJson(std::string& accept)
	{
		if (accept.empty())
		{
			return false;
		}
		if (!JsonReader(accept, m_jv))
		{
			return false;
		}
		return true;
	}
	void Clear(void)
	{
		m_jv.clear();
	}
	void set_from_socket_id(uint32_t sockid)
	{
		from_socket_id = sockid;
	}
public:
	const Json::Value& GetJsonValue()const
	{
		return m_jv;
	}
	uint32_t GetFromSocketId()const { return from_socket_id; }
private:
	Json::Value m_jv;
	uint32_t from_socket_id;
};

#endif